package com.hsylient.javase.chapter11.demo04;

/**
 * 创建了一个子线程，这个子线程在不停的数数(死循环)
 *
 * 主线程先是睡了一秒钟，然后他把子线程停下来了
 */
public class StopTest {

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            for (;;) {
                System.out.println(Thread.currentThread().getName());
            }
        });
        thread.start();
        Thread.sleep(1000);
        thread.stop();
    }
}
